package com.gufe.service.user.impl.prereserve;

import com.gufe.dto.prereserve.BasicInfoDTO;
import com.gufe.dto.prereserve.MilitaryInfoDTO;
import com.gufe.dto.prereserve.RetiredInfoDTO;
import com.gufe.dto.prereserve.StudyExperienceInfoDTO;
import com.gufe.entity.BasicInfo;
import com.gufe.entity.MilitaryInfo;
import com.gufe.entity.RetiredInfo;
import com.gufe.entity.StudyExperienceInfo;
import com.gufe.mapper.user.prereserve.SaveInfoMapper;
import com.gufe.service.user.prereserve.SaveInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SaveInfoServiceImpl implements SaveInfoService {

    @Autowired
    private SaveInfoMapper saveInfoMapper;
    /**
     * 存储基本信息
     * @param basicInfoDTO
     */
    public void saveBasicInfo(BasicInfoDTO basicInfoDTO) {
        BasicInfo basicInfo = new BasicInfo();
        BeanUtils.copyProperties(basicInfoDTO,basicInfo);
        saveInfoMapper.saveBasicInfo(basicInfo);
    }

    /**
     * 存储军事社团信息
     * @param militaryInfoDTO
     */
    public void saveMilitaryInfo(MilitaryInfoDTO militaryInfoDTO) {
        MilitaryInfo militaryInfo = new MilitaryInfo();
        BeanUtils.copyProperties(militaryInfoDTO,militaryInfo);
        saveInfoMapper.saveMilitaryInfo(militaryInfo);
    }

    /**
     * 存储退役信息
     * @param retiredInfoDTO
     */
    public void saveRetiredInfo(RetiredInfoDTO retiredInfoDTO) {
        RetiredInfo retiredInfo = new RetiredInfo();
        BeanUtils.copyProperties(retiredInfoDTO,retiredInfo);
        saveInfoMapper.saveRetiredInfo(retiredInfo);
    }

    /**
     * 存储学习经历信息
     * @param studyExperienceInfoDTO
     */
    public void saveStudyInfo(StudyExperienceInfoDTO studyExperienceInfoDTO) {
        StudyExperienceInfo studyExperienceInfo = new StudyExperienceInfo();
        BeanUtils.copyProperties(studyExperienceInfoDTO,studyExperienceInfo);
        saveInfoMapper.saveStudyInfo(studyExperienceInfo);
    }
}
